package com.starlink.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.starlink.common.PageInfoTwo;
import com.starlink.model.domain.ShoppingCartDetailDO;
import com.starlink.model.request.ShoppingCartDetailRequest;
import com.starlink.model.vo.ShoppingCartDetailVO;
import com.starlink.model.vo.book.CartSpecificationVO;

import java.util.List;
import java.util.Map;

/**
 * @author zhanghong
 */
public interface ShoppingCartDetailService extends IService<ShoppingCartDetailDO> {

    /**
     * 根据主键查询
     * @param id
     * @return
     */
    ShoppingCartDetailVO getByKey(long id);
    /**
     * 分页查询，手动分页
     * @param request
     * @return
     */
    PageInfoTwo<ShoppingCartDetailVO> pageQuery(ShoppingCartDetailRequest request);
    /**
     * 列表查询
     * @param request
     * @return
     */
    List<ShoppingCartDetailVO> listQuery(ShoppingCartDetailRequest request);
    /**
     * 新增
     * @param request
     * @return
     */
    Boolean add(ShoppingCartDetailRequest request);
    /**
     * 根据主键更新
     * @param request
     * @return
     */
    Boolean updateByKey(ShoppingCartDetailRequest request);
    /**
     * 根据主键删除
     * @param ids
     * @return
     */
    Boolean deleteDOByIds(String ids);

    /**
     * 根据用户ID查询购物车商品数量
     * @param userId
     * @return
     */
    Map<String,Long> getByUserId(long userId);

    /**
     * 加入购物车
     * @param request
     * @return
     */
    Boolean addCarDetail(ShoppingCartDetailRequest request);

    /**
     * 购物车商品数量修改
     * @param request
     * @return
     */
    Boolean addCar(ShoppingCartDetailRequest request);

    List<ShoppingCartDetailVO> selectList(Long carId);

    /**
     * 将结算商品从购物车移除
     * @param orderCarProductIds
     */
    void batchDeleted(List<Long> orderCarProductIds);

    /**
     * 查询购物车中商品规格信息
     * @param carId
     * @return
     */
    List<CartSpecificationVO> selectCartSpecificationList(Long carId);

    /**
     * 修改购物车商品为结算状态
     * @param carId
     * @param articlesIdList
     */
    void updateByParam(Long carId, List<Long> articlesIdList);

}
